package com.sunda.spmswms.mapper;

import com.sunda.spmswms.entity.ShelfOnTaskDtl;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 上架任务表明细 Mapper 接口
 * </p>
 *
 * @author Wayne
 * @since 2021-03-19
 */
@Mapper
public interface ShelfOnTaskDtlMapper extends BaseMapper<ShelfOnTaskDtl> {

    @Select("SELECT DN.DELIVERY_NOTE_SAP AS \"deliveryNoteSap\", \n" +
            "       BN.BOX_NOTE AS \"boxNote\", \n" +
            "       BN.BOX_QTY_RECEIVED AS \"boxQtyReceived\"\n" +
            "FROM SAP_DELIVERY_NOTE DN\n" +
            "    LEFT JOIN SAP_BOX_NOTE BN ON DN.PACKAGE_NOTE = BN.PACKAGE_NOTE\n" +
            "WHERE DN.DELIVERY_NOTE_SAP = #{deliveryNoteSap} AND BN.BOX_QTY_RECEIVED > 0 ")
    List<Map<String, Object>> getBoxNote(String deliveryNoteSap);

}
